Resolution - The difference between smooth and abrupt variations
Difficulty Level:
Tags record☁resolution

Like shown in the Jupyter Notebook entitled "Problems of low sampling rate (aliasing)" dedicated to present the importance of choosing a proper sampling frequency, resolution is another parameter that must be configured prior to acquisition.

For PLUX acquisition systems, that support acquisitions with resolutions between 6 ( BITalino ) and 16 bits, a smaller resolution may not cause observable changes in EMG or ECG, however, in some cases, such as temperature monitoring, the acquired signal is considerably affected when different resolutions are chosen, as we will see in this Jupyter Notebook , by comparing the same signal (a 2 minutes acquisition with rise and drop of temperature) when acquired with distinct resolutions.


0 - Resolutions available on biosignalsplux

1 - Importation of the needed packages

In [1]:
# biosignalsnotebooks own package for loading and plotting the acquired data
import biosignalsnotebooks as bsnb

# Scientific package/functions for interpolation purposes
import numpy

2 - Load of acquired temperature data

In [2]:
# Load of data.
data, header = bsnb.load_signal("temp_res_8_16", get_header=True)

3 - Identification of mac addresses of the devices and the respective channels used during acquisition

3.1 - Device used for acquiring data with an analog to digital converter resolution of 8 bits

In [3]:
# Acquisition 8 bits
print(data)
mac_address_8_bits = list(data.keys())[0]
channel_8_bits = list(data[mac_address_8_bits].keys())[0]
{'00:07:80:79:6F:DB': {'CH1': array([118, 118, 118, ..., 103, 103, 103], dtype=uint16)}, '00:07:80:D8:A7:F9': {'CH2': array([30512, 30518, 30524, ..., 26720, 26720, 26712], dtype=uint16)}}

3.2 - Device used for acquiring data with an analog to digital converter resolution of 16 bits

In [4]:
# Acquisition 16 bits
mac_address_16_bits = list(data.keys())[1]
channel_16_bits = list(data[mac_address_16_bits].keys())[0]
In [5]:
from sty import fg, rs
print (fg(98,195,238) + "\033[1mMac Address (8 bits): \033[0m" + fg.rs + str(mac_address_8_bits) + " \033[1mChannel:\033[0m " + str(channel_8_bits))
print (fg(232,77,14) + "\033[1mMac Address (16 bits):\033[0m" + fg.rs + str(mac_address_16_bits) + " \033[1mChannel:\033[0m " + str(channel_16_bits))
Mac Address (8 bits): 00:07:80:79:6F:DB Channel: CH1
Mac Address (16 bits):00:07:80:D8:A7:F9 Channel: CH2

4 - Storage of each signal in a different variable and generation of the respective time axis

4.1 - Identification of the acquisition sampling rate

The sampling rate is equal for both devices !

In [6]:
# Sampling rate of the acquisition.
sr = header[mac_address_8_bits]["sampling rate"]
device = header[mac_address_8_bits]["device"]

4.2 - Transposition of data to an independent variable

In [7]:
# [8 bits]
data_8_bits = data[mac_address_8_bits][channel_8_bits]

# [16 bits]
data_16_bits = data[mac_address_16_bits][channel_16_bits]

4.3 - Conversion of sample values to Celsius degrees

In [8]:
# [8 bits]
data_8_bits = bsnb.raw_to_phy(sensor="TEMP", device=device, raw_signal=data_8_bits, resolution=8, option="C")

# [16 bits]
data_16_bits = bsnb.raw_to_phy(sensor="TEMP", device=device, raw_signal=data_16_bits, resolution=16, option="C")

4.4 - Generation of a time-axis

Both acquisitions contain the same number of samples, considering the synchronous record with a fixed sampling rate !

In [9]:
time = numpy.linspace(0, len(data_8_bits) / sr, len(data_8_bits))

Representation of acquired signals and zoomed sections to highlight the influence of choosing a proper resolution

In [10]:
bsnb.plot_compare_resolutions(time, data_8_bits, data_16_bits, sr)

With this graphical example it can easily be seen the importance of choosing an adequate resolution. Higher resolution requires more computational and electronic resources to be done, but brings precision to the analysis.

We hope that you have enjoyed this guide. biosignalsnotebooks is an environment in continuous expansion, so don"t stop your journey and learn more with the remaining Notebooks !

In [11]:
from biosignalsnotebooks.__notebook_support__ import css_style_apply
css_style_apply()
.................... CSS Style Applied to Jupyter Notebook .........................
Out[11]: